package com.ningju.procurement.common.money;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;

public class MoneySerializer extends StdSerializer<Money> {
	private static final long serialVersionUID = 1L;

	public MoneySerializer() {
		this(null);
    }
   
    public MoneySerializer(Class<Money> t) {
    	super(t);
    }

	@Override
	public void serialize(Money value, JsonGenerator gen, SerializerProvider provider) throws IOException {
		gen.writeStartObject();
		gen.writeStringField("amount", value.getAmount().toString());
		gen.writeEndObject();
	}
	
}
